<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<script>
			function removeHTMLTag(str) {
				
			str=str.replace(/\"/g,"'");
            str = str.replace(/<\/?[^>]*>/g,''); //去除HTML tag
            str = str.replace(/[ | ]*\n/g,'\n'); //去除行尾空白
            //str = str.replace(/\n[\s| | ]*\r/g,'\n'); //去除多余空行
            str=str.replace(/&nbsp;/ig,'');//去掉&nbsp;
            return str;
    	}
			var html='<h1 style="color:red">你好</h1>';
			//alert(removeHTMLTag(html));
			console.info(html.replace(/<\/?[^>]*>/g,''));
			/[^ -~]/g
		</script>
	</body>
</html>
